// N1String.h: interface for the N1String class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_N1STRING_H__1D22F98F_7B92_4B8D_A5CC_F997147FC166__INCLUDED_)
#define AFX_N1STRING_H__1D22F98F_7B92_4B8D_A5CC_F997147FC166__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "N1Lib.h"

class N1Object;

class NEXPORT N1String : public N1Object {
protected:
    char       *m_pStr;
    N1UInt32    m_nLength;

    void  free();
    char *alloc(N1UInt32 size);

public:
	N1String();
	virtual ~N1String();

    virtual const char*   name() const ;
    virtual const char*   description() const ;

    N1String(const char *string);
    N1String(const char *string, N1UInt32 length);
    N1String(char c);

    N1String(const N1String &string);

    N1String(const char* Format, va_list list);
    N1String(const char* Format, ...);

    operator const char*() const ;

    const N1String& operator=(const char *string);
    const N1String& operator=(const N1String &string);

    const char* cString() const ;

    N1UInt32 getLength() const ;

    N1UInt32 getBufferSize() const { return m_nLength; };
    void     setBufferSize(N1UInt32 size);

    char getAt(N1UInt32 index) const ;
    char setAt(N1UInt32 index, char c);

    void append(char c);
    void append(const char *string);
    void append(const char *string, N1UInt32 length);

    void insertAt(N1UInt32 index, const char *string);

    void removeAt(N1UInt32 index, N1UInt32 length);

    int  find(N1UInt32 from, const char *string) const ;
    
    void removeLastPathComponent();
};


/*
    N1String(wchar_t *wstring);
    N1String(wchar_t *wstring, int length);
    N1String(wchar_t wc);

    operator const wchar_t*();
    void append(wchar_t c);
    void append(const wchar_t *string);
    void append(const wchar_t *string, int length);

    void insertAt(int index, const wchar_t *string);

    int  find(int from, wchar_t *string);
*/

#endif // !defined(AFX_N1STRING_H__1D22F98F_7B92_4B8D_A5CC_F997147FC166__INCLUDED_)
